<template>
	<view class="box">
		<!-- #ifdef MP-WEIXIN -->
		<view class="head" :style="'padding-top:'+statusBarHeight1+'px;padding-right:'+ (WXwidth + 15) +'px;height:' + (statusBarHeight1 + 44) + 'px'">
		<!-- #endif -->
		<!-- #ifndef MP-WEIXIN -->
		<view class="head" :style="'padding-top:'+(statusBarHeight1+10)+'px;height:' + (statusBarHeight1 + 54) + 'px'">
		<!-- #endif -->
			<image class="fanhui" @click="fanhui" src="https://pic.bangbangtongcheng.com/static/fanhui_bai.png"
					mode=""></image>
			<view class="centers">简历模板</view>
			<view class="fanhui"></view>
		</view>
		<!-- #ifdef MP-WEIXIN -->
		<view
			:style="'padding-top:'+statusBarHeight1+'px;height:' + (statusBarHeight1 + 44) + 'px;background-color: #64B6A8;'">
		</view>
		<!-- #endif -->
		<!-- #ifndef MP-WEIXIN -->
		<view
			:style="'padding-top:'+statusBarHeight1+'px;height:' + (statusBarHeight1 + 54) + 'px;background-color: #64B6A8;'">
		</view>
		<!-- #endif -->
		<view class="center">
			<view class="title">请选择简历模板</view>
			<scroll-view class="list" scroll-y="true" :style="'height: calc(100vh - '+ curTop + 'px );'">
				<view class="biographicalNotes">
					<view class="item" v-for="(i,j) in list" :key="j" @click="details(i)">
						<image class="image" :src="`${$commonTemResume}${i.pictureAttachment}`" mode=""></image>
						<view class="titles">
							<view class="large_titles">
								{{i.title}}-
							</view>
							<view class="small_titles">
								{{i.content}}
							</view>
						</view>
					</view>
				</view>
			</scroll-view>
		</view>
		<uniBall ref="uniBall"></uniBall>
	</view>
</template>
<script>
	import permision from "@/js_sdk/wa-permission/permission.js"
	//#ifdef H5
	import wxshare from "@/utils/index.js";
	//#endif
	import {
		mapGetters
	} from "vuex";
	export default {
		data() {
			return {
				userInfo: uni.getStorageSync("Pduser"),
				WXwidth: '',
				curTop: 300,
				list:[],
				curriculumVitae:{}
			};
		},
		onLoad(options) {
			var than = this;
			// 获取微信小程序胶囊和据右边宽度
			// #ifdef MP-WEIXIN
			// 获取胶囊信息
			let menuButtonInfo = uni.getMenuButtonBoundingClientRect()
			let getWindowInfo = uni.getWindowInfo().screenWidth
			this.WXwidth = getWindowInfo - (menuButtonInfo.right - menuButtonInfo.width);
			// #endif
			this.obtainResumeTemplate()
			this.curriculumVitae = uni.getStorageSync('JLMB_key');
			console.log(this.curriculumVitae,'9-9-9-9-9')
			uni.removeStorageSync('JLMB_key');
			/* #ifdef H5 */
			this.jinzhi();
			/* #endif */
		},
		mounted() {
			let that = this
			this.$nextTick(function() {
				uni.createSelectorQuery().in(this).select('.list').boundingClientRect(result => {
					if (result) {
						that.curTop = result.top
					}
				}).exec();
			})
		},
		computed: {
			...mapGetters(["userid", "islogin", "statusBarHeight1", "userinfo"])
		},
		methods: {
			// 获取简历模板
			obtainResumeTemplate(){
				this.$myRequest.get("/api/mobile/personnelOwner/getResumeTemplate").then(res => {
					this.list=res.resumeTemplate
				});
			},
			fanhui(){
				uni.navigateBack({  
				    delta: 1
				});
			},
			details(item) {
				uni.setStorageSync('JLMB1_key', this.curriculumVitae);
				uni.navigateTo({
					url: "/pages_recruitMoney/resume/previewEffect?attachmentConversion="+ item.attachmentConversion + '&title='+(item.title+item.content),
				});
			},
			jinzhi() {
				let _this = this;
				let param = window.location.href.split("#")[0];
				uni.request({
					method: "post",
					data: {
						url: param
					},
					header: {
						"content-type": "application/x-www-form-urlencoded",
					},
					url: "https://www.bangbangtongcheng.com/conven//mob/login/getJsTicket.do",
					success(re) {
						_this.jinzhifx(re.data);
					},
				});
			},
			jinzhifx(data) {
				wxshare.config({
					debug: false, //是否打开调试
					appId: data.appId, // 公众号的唯一标识
					timestamp: data.timestamp, // 生成签名的时间戳
			 	nonceStr: data.nonce, // ，生成签名的随机串
					signature: data.signature, // 签名
					jsApiList: ["hideMenuItems"],
				});
				// 禁止分享
				wxshare.hideMenuItems({
					// 要隐藏的菜单项，只能隐藏“传播类”和“保护类”按钮，所有menu项见附录3
					menuList: [
						"menuItem:share:appMessage",
						"menuItem:share:timeline",
						"menuItem:share:timeline",
						"menuItem:share:qq",
						"menuItem:favorite",
						"menuItem:share:QZone",
						"menuItem:openWithSafari",
					],
				});
			},
		},
	};
</script>
<style lang="less" scoped>
	.box {
		width: 100%;
		min-height: 100vh;
		background-color: #fff;
	}

	.head {
		position: fixed;
		top: 0;
		left: 0;
		width: 750rpx;
		display: flex;
		align-items: center;
		justify-content: space-between;
		padding: 0 15px;
		background-color: #64B6A8;
		z-index: 1000;

		.fanhui {
			width: 40rpx;
			height: 40rpx;
		}

		.centers {
			font-size: 36rpx;
			font-weight: 400;
			color: #FFFFFF;
		}

		.head_right {
			font-size: 30rpx;
			font-weight: 400;
			color: #FFFFFF;
		}
		
		.image{
			width: 50rpx;
			height: 50rpx;
		}
	}
	.center{
		padding: 40rpx 40rpx 0 40rpx;
		.title{
			font-size: 34rpx;
			font-weight: 600;
			color: #000000;
			margin-bottom: 20rpx;
		}
		.biographicalNotes{
			display: flex;
			justify-content: space-between;
			flex-wrap: wrap;
			.item{
				width: 320rpx;
				margin-bottom: 50rpx;
				.image{
					width: 320rpx;
					height: 460rpx;
					border-radius: 10rpx;
					box-shadow: 0px 3rpx 10rpx 1px rgba(0, 0, 0, 0.17);
				}
				.titles{
					display: flex;
					align-items: center;
					justify-content: center;
					font-size: 28rpx;
					font-weight: 400;
					.large_titles{
						color: #333333;
					}
					.small_titles{
						color: #64B6A8;
					}
				}
			}
		}
	}
</style>
